# centos 上，以root跑如下1行命令即可更新 public_key 
# mkdir tmp_for_update_public_key && cd tmp_for_update_public_key && apt install -y git && git clone https://gitee.com/shihowcom/public_key.git && chmod 777 ./public_key/update_public_key.sh && ./public_key/update_public_key.sh

mkdir -p ~/.ssh
chmod 700 ~/.ssh

# 删除老 authorized_keys 文件
rm -f ~/.ssh/authorized_keys

cp public_key/authorized_keys ~/.ssh/
chmod 600 ~/.ssh/authorized_keys

# 设置 root 密码永久有效
chage -M 99999 root

# 清理临时文件
cd ..
rm -rf tmp_for_update_public_key

# -----------------------------
# 每台机器只需要做一次的工作：

# ssh其它配置
# vi /etc/ssh/sshd_config

# RSAAuthentication yes
# PubkeyAuthentication yes
# PasswordAuthentication no
# PermitRootLogin yes

# service sshd restart
# -----------------------------
